cmake_minimum_required(VERSION 3.15)

sdk_append_inc(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/class/hid)
sdk_append_inc(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/class/cdc)
sdk_append_inc(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/class/msc)
sdk_append_inc(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/class/dfu)
sdk_append_inc(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/class/hub)
sdk_append_inc(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/class/video)
sdk_append_inc(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/common)
sdk_append_inc(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/demo)
sdk_append_inc(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/core)
sdk_append_inc(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/port/${USBIP})

# USB source
if(${DEMO_TYPE} STREQUAL "device")
sdk_append_source(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/core/usbd_core.c)
sdk_append_source(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/port/${USBIP}/${USB_DRV})
sdk_append_source(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/class/cdc/usbd_cdc.c)
sdk_append_source(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/class/hid/usbd_hid.c)
sdk_append_source(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/class/dfu/usbd_dfu.c)
sdk_append_source(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/class/video/usbd_video.c)
elseif(${DEMO_TYPE} STREQUAL "host")
sdk_append_source(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/core/usbh_core.c)
sdk_append_source(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/port/${USBIP}/${USB_DRV})
sdk_append_source(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/class/hub/usbh_hub.c)
sdk_append_source(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/class/msc/usbh_msc.c)
sdk_append_source(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/class/cdc/usbh_cdc.c)
sdk_append_source(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/class/hid/usbh_hid.c)
sdk_append_inc(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/osal)
sdk_append_source(${CMAKE_CURRENT_LIST_DIR}/CherryUSB/osal/usb_osal_rtthread.c)
endif()
add_subdirectory(drv)

